﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using Volo.Abp;
using Volo.Abp.Domain.Entities.Auditing;

namespace ACM.MES.工序
{
    public class Operation : FullAuditedEntity<Guid>
    {
        public Operation()
        {
        }

        public Operation(Guid id,string opCode,string description,string remark) : base(id)
        {
            SetOpCode(opCode);
            this.Description = description;
                this.Remark = remark;
        }


        /// <summary>
        /// OpCode 标准工序代号  
        /// </summary>
        public string OpCode { get; private set; }
        /// <summary>
        /// Description 说明  
        /// </summary>
        public string Description { get; set; }
        /// <summary>
        /// Remark 备注  
        /// </summary>
        public string Remark { get; set; }


        internal Operation ChangeOpCode(string name)
        {
            SetOpCode(name);
            return this;
        }

        private void SetOpCode(string opCode)
        {
            this.OpCode = Check.NotNullOrWhiteSpace(opCode,nameof(opCode),maxLength: OperatonConsts.MaxOpCodeLength);
        }
    }
}
